﻿@model IEnumerable<MvcAtletIS.Models.Documents>
@{
    ViewBag.Title = "Dokumenty";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section head {
    
    <style type="text/css">
        table { border: solid 1px #e8eef4; border-collapse: collapse; font-size: 12px; }
        tr:nth-child(odd) { background:#eee; }
        tr:nth-child(even) { background:#fff; }
    </style>
}

    <h2>Dokumenty</h2>

    <!-- --------- FILTER ---------- -->
@using (Html.BeginForm())
{ 
    <div class="filter-frame">
        
        <div class="filter-item">
            <div class="editor-label">
                Vyberte kategóriu dokumentov
            </div>
            <div class="editor-field">
                @Html.DropDownList("CategoryId", null, null, new { onchange = "this.form.submit();" })
            </div>
        </div>

    </div>
}

    
    <!-- --------- OTHER ---------- -->
@if (ViewBag.ImportantSubcategories != null)
{
    <div id="sidebar">
    @foreach (var commonSubcategory in ViewBag.CommonSubcategories)
    { 
        <div class="sidebar-title">
            @commonSubcategory.Name
        </div>
    
        foreach (var comDoc in Model.Where(d => d.SubcategoryId == commonSubcategory.ID))
        {
            <div class="sidebar-link">
                <a href="@Url.Content("~/Content/docs/" + @comDoc.Path)" target="_blank">
                    @comDoc.Title
                </a>
            </div>
        }
    }
    </div>
}
    
    
    
    <!-- --------- IMPORTANT ---------- -->
@if (ViewBag.ImportantSubcategories != null)
{
    <div id="content">
@foreach (var importantSubcategory in ViewBag.ImportantSubcategories)
{ 
        <div id="next-articles">
            @importantSubcategory.Name
        </div>
    
        <table width="100%">
        @foreach (var impDoc in Model.Where(d => d.SubcategoryId == importantSubcategory.ID))
        {
            <tr>
                <td width="15%">
                    @Html.DisplayFor(modelItem => impDoc.Date)
                </td>
                <td width="50%">
                    @Html.DisplayFor(modelItem => impDoc.Title)
                </td>
                <td width="30%">
                    @Html.DisplayFor(modelItem => impDoc.Author)
                </td>
                <td width="5%">
                    <a href="@Url.Content("~/Content/docs/" + @impDoc.Path)" target="_blank">
                        <img src="@Url.Content("~/Content/icons/preview.gif")" alt="Preview" />
                    </a> 
                </td>
            </tr>    
        }
        </table>        
}
    </div>
}

    
